package com.gebogebo.android.pub;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.TextView;

public class PickYourColorDialogActivity extends Activity implements OnClickListener {

	private Dialog PickColorDialog;
	private TextView TextFieldText;
	private EditText PickColorTextEdit;
	private Context mContext;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
        
        super.onCreate(savedInstanceState);     
        
        Log.v("Pick Color Activity","Got to view");
        mContext = this;
        
        PickColorDialog = new Dialog(mContext);        
        PickColorDialog.setContentView(R.layout.pickcolordialoglayout);        
        PickColorDialog.setTitle("Select pen color?");        
        
        PickColorDialog.findViewById(R.id.colorpick1).setOnClickListener(this);        
        PickColorDialog.findViewById(R.id.colorpick2).setOnClickListener(this);
        PickColorDialog.findViewById(R.id.colorpick3).setOnClickListener(this);
        PickColorDialog.findViewById(R.id.colorpick4).setOnClickListener(this);
        PickColorDialog.findViewById(R.id.colorpick5).setOnClickListener(this);
        
        Log.v("Pick Color Activity","Buttons are setup and created.");        
        
        PickColorDialog.show();
        
        Log.v("Pick Color Activity","Started Show view");
    }
	
	
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		int id = v.getId();
		Intent myIntent;
		myIntent = getIntent();
		switch(id){
		case R.id.colorpick1:
			myIntent.putExtra("ColorPicked", "#008000");
			break;
		case R.id.colorpick2:
			myIntent.putExtra("ColorPicked", "#FFFF00");
			break;
		case R.id.colorpick3:
			myIntent.putExtra("ColorPicked", "#FF0000");
			break;
		case R.id.colorpick4:
			myIntent.putExtra("ColorPicked", "#0000FF");
			break;
		case R.id.colorpick5:
			myIntent.putExtra("ColorPicked", "#000000");
			break;
		default:
			myIntent.putExtra("ColorPicked", "#FF0000");
			break;
		}
		setResult(Constants.GET_COLOR_SELECTED,myIntent);
		PickColorDialog.cancel();
		finish();
	}

}
